<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			function funload() {
				if(window.WebSocket) {
					console.log('This browser supports WebSocket');
				} else {
					console.log('This browser does not supports WebSocket');
				}
				var socket = new WebSocket('ws://www.baidu.com'); //http->ws; https->wss
				// websocket = new WebSocket(wsUri); 
				socket.send('hello WebSockt');
				socket.onmessage = function(event) {
					var data = event.data;
					console.log(data)
				}
			}
		</script>
	</head>

	<body>
		<button onclick="funload()">载入</button>
	</body>

</html>